#include<iostream>
#include<cstring>
#include<vector>
#include<algorithm>
#include<cstdio>

using namespace std;

const int maxn = 6; // the maximum number of stone
int w[maxn]; // the weight of stone
int n; // the number of stone
double r; // the width of the room
int st[(1<<maxn)+5]; // the weight of subset
int vis[(1<<maxn)+5];

struct C{
    double lw,rw;
    C(double lw=0,double rw=0):lw(lw),rw(rw){}
};
vector<C> record[(1<<maxn)+5];

void solve(int subset){
    if(vis[subset]) return;
    vis[subset] = 1;

    bool has_child = false;

    int left,right; // left  and right subset
    double lw,rw; // left  and right width

    for(left = (subset-1)&subset; left; left=(left-1)&subset){
        has_child = true;
        right = left ^ subset;

        solve(left);
        solve(right);

        lw = 1.0 * st[right] / st[subset];
        rw = 1.0 * st[left] / st[subset];

        double lw2,rw2;
        for(int i=0;i<record[left].size();i++){
            for(int j=0;j<record[right].size();j++){
                lw2 = max(record[left][i].lw+lw,record[right][j].lw-rw);
                rw2 = max(record[left][i].rw-lw,record[right][j].rw+rw);
                record[subset].push_back(C(lw2,rw2));
            }
        }
    }

    if(!has_child){
        record[subset].push_back(C());
    }
}

void print(){
    double max=-1,needmax=-1;// max means the maximum of all cases
                          // needmax indicates the maximum of all feasible cases
    int root =  (1<<n)-1;
    for(int i=1;i<record[root].size();i++){
        double width = record[root][i].lw + record[root][i].rw;
        if(width > max)
            max = width;
        if(width < r && width > needmax){
            needmax = width;
        }
    }
    printf("%.10lf\n",needmax);
}


int main(){

    freopen("data.in","r",stdin);
    freopen("data.out","w",stdout);

    int T;
    cin >> T;
    while(T--){
        cin >> r >> n;
        for(int i=1;i<=n;i++){
            cin >> w[i];
        }

        memset(st,0,sizeof(st));
        for(int i=0; i<=(1<<n)-1; i++){
            record[i].clear();
            for(int j=1;j<=n;j++){
                if( (1<<(j-1)) & i)
                    st[i] += w[j];
            }
        }

        memset(vis,0,sizeof(vis));
        solve((1<<n)-1);
        print();

    }


    return 0;
}